home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- from util.primitives import dictdiff
- import cPickle
- from traceback import print_exc
-
- class HashedAccount(object):
-
- def min_hash(self):
- return ''.join((lambda .0: for c in .0:
- str(c))([
- self.id,
- self.protocol,
- self.username]))
-
-
- def total_hash(self):
- if not hasattr(self, 'xml_element_name'):
- data = self.get_options()
- else:
-
- try:
- if self.data is not None:
- data = cPickle.loads(self.data)
-
- try:
- d = self.protocol_info()['defaults']
- except KeyError:
- d = { }
-
- data = dictdiff(d, data)
- import common.protocolmeta as pm
- if self.protocol in pm.improtocols.keys():
- for k in data.keys():
- if k not in d:
- data.pop(k)
- continue
-
- else:
-
- try:
- opts = self.protocol_info()['whitelist_opts']
- except KeyError:
- opts = ()
-
- for k in data.keys():
- if k not in opts:
- data.pop(k)
- continue
-
- else:
- data = None
- except Exception:
- print 'data was: %r' % self.data
- print_exc()
- data = None
-
- return (''.join((lambda .0: for c in .0:
- str(c))([
- self.id,
- self.protocol,
- self.username,
- self.password])), data)
-
-
- def protocol_info(self, proto = sentinel):
- protocols = protocols
- import common.protocolmeta
- return None[protocols if proto is not sentinel else self.protocol]
-
-
- def _total_hash(self):
- return getattr(self, '_total_hash_', None)
-
- _total_hash = property(_total_hash)
-
- def store_hash(self, hash = sentinel):
- self._total_hash_ = None if hash is not sentinel else self.total_hash()
-
-
-
- class HashedAccounts(object):
-
- def calc_hash(self):
- if not hasattr(self, 'xml_element_name'):
- return sorted((lambda .0: for a in .0:
- a._total_hash)(self))
- else:
- return dict((lambda .0: for a in .0:
- (a.id, a.total_hash()))(self))
-
-
-